﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace JeanFish.AnA.OAuth2
{
    public class Syntaxes
    {
        const string ALPHA = "[\u0041-\u005A\u0061-\u007A]";
        const string DIGIT = "[\u0030-\u0039]";
        const string VSCHAR = "[\u0020-\u007E]";
        const string NQCHAR = "[\u0021\u0023-\u005B\u005D-\u007E]";
        const string NQSCHAR = "[\u0020-\u0021\u0023-\u005B\u005D-\u007E]";
        const string UNICODECHARNOCRLF = "[\u0009\u0020-\u007E\u0080-\uD7FF\uE000-\uFFFD\U00010000-\U0010FFFF]";
        public const string ClintIDSyntaxName = "client_id";
        public static Regex ClientIDSyntax = new Regex(VSCHAR+"*");
        public const string ClientSecretSyntaxName = "client_secret";
        public static Regex ClientSecretSyntax = new Regex(VSCHAR + "*");
        public const string EndpointURISyntaxName = "endpoint_uri";
    }
    public class MalformedSyntaxException : Exception
    {
        public string SyntaxName { get; private set; }
        public MalformedSyntaxException(string syntax,string message)
            : base(message) { this.SyntaxName = syntax; }
        public MalformedSyntaxException(string syntax,string message,Exception innerException)
            : base(message, innerException) { this.SyntaxName = syntax; }
    }
}
